/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.manage.repository.mapper;

import info.peigen.hotpot.business.account.core.repository.entity.BankEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlManageMapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

/**
 * <b>(BankManageMapper)</b>
 * 管理后台 "银行" 数据库映射服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-08-29
 */
@SuppressWarnings("unused")
public interface BankManageMapper extends AbstractBeetlSqlManageMapper<BankEntity> {

    // 唯一索引[bank_id]
    @Sql("select * from bank where bank_id = ?")
    @Select
    BankEntity findByBankId(String bankId);

    @Sql("select * from bank where bank_id = ? for update")
    @Select
    BankEntity lockByBankId(String bankId);

    @Sql("delete from bank where bank_id = ?")
    @Update
    void deleteByBankId(String bankId);

    // 唯一索引[bank_code]
    @Sql("select * from bank where bank_code = ?")
    @Select
    BankEntity findByBankCode(String bankCode);

    @Sql("select * from bank where bank_code = ? for update")
    @Select
    BankEntity lockByBankCode(String bankCode);

    @Sql("delete from bank where bank_code = ?")
    @Update
    void deleteByBankCode(String bankCode);

    // 索引[account_type]
    @Sql("select * from bank where account_type = ?")
    @Select
    BankEntity findByAccountType(String accountType);

    @Sql("delete from bank where account_type = ?")
    @Update
    void deleteByAccountType(String accountType);

    // 索引[partner_id]
    @Sql("select * from bank where partner_id = ?")
    @Select
    BankEntity findByPartnerId(String partnerId);

    @Sql("delete from bank where partner_id = ?")
    @Update
    void deleteByPartnerId(String partnerId);
}